/*
Copyright [2023] [fuwen_soft]
*/
package vip.xiaonuo.modular.xygenealogycate.controller;

import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.xygenealogycate.param.XyGenealogyCateParam;
import vip.xiaonuo.modular.xygenealogycate.service.XyGenealogyCateService;
import vip.xiaonuo.modular.xygenealogycate.entity.XyGenealogyCate;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import vip.xiaonuo.core.annotion.version.AdminVersionSwagger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.List;
import vip.xiaonuo.sys.core.msg.Result;
import static vip.xiaonuo.sys.core.msg.ResultUtils.success;
/**
 * 谱文分类控制器
 *
 * @author yanwei
 * @date 2023-05-05 15:44:29
 */
@RestController
@Api(tags = "后台管理 谱文分类 相关APIS")
@AdminVersionSwagger
public class XyGenealogyCateController {

    @Resource
    private XyGenealogyCateService xyGenealogyCateService;

    /**
     * 查询谱文分类
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @GetMapping("/xyGenealogyCate/page")
    @BusinessLog(title = "谱文分类_查询", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("谱文分类_查询")
    public Result<PageResult<XyGenealogyCate>> page(XyGenealogyCateParam xyGenealogyCateParam) {
        PageResult<XyGenealogyCate> page = xyGenealogyCateService.page(xyGenealogyCateParam);
        return success(page);
    }

    /**
     * 添加谱文分类
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @PostMapping("/xyGenealogyCate/add")
    @BusinessLog(title = "谱文分类_增加", opType = LogAnnotionOpTypeEnum.ADD)
    @ApiOperation("谱文分类_增加")
    public Result add(@RequestBody @Validated(XyGenealogyCateParam.add.class) XyGenealogyCateParam xyGenealogyCateParam) {
            xyGenealogyCateService.add(xyGenealogyCateParam);
        return success();
    }

    /**
     * 删除谱文分类，可批量删除
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @PostMapping("/xyGenealogyCate/delete")
    @BusinessLog(title = "谱文分类_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    @ApiOperation("谱文分类_删除")
    public Result delete(@RequestBody @Validated(XyGenealogyCateParam.delete.class) List<XyGenealogyCateParam> xyGenealogyCateParamList) {
            xyGenealogyCateService.delete(xyGenealogyCateParamList);
        return success();
    }

    /**
     * 编辑谱文分类
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @PostMapping("/xyGenealogyCate/edit")
    @BusinessLog(title = "谱文分类_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    @ApiOperation("谱文分类_编辑")
    public Result edit(@RequestBody @Validated(XyGenealogyCateParam.edit.class) XyGenealogyCateParam xyGenealogyCateParam) {
            xyGenealogyCateService.edit(xyGenealogyCateParam);
        return success();
    }

    /**
     * 查看谱文分类
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @GetMapping("/xyGenealogyCate/detail")
    @BusinessLog(title = "谱文分类_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
    @ApiOperation("谱文分类_查看")
    public Result<XyGenealogyCate> detail(@Validated(XyGenealogyCateParam.detail.class) XyGenealogyCateParam xyGenealogyCateParam) {
        XyGenealogyCate detail =   xyGenealogyCateService.detail(xyGenealogyCateParam);
        return success(detail);
    }

    /**
     * 谱文分类列表
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @GetMapping("/xyGenealogyCate/list")
    @BusinessLog(title = "谱文分类_列表", opType = LogAnnotionOpTypeEnum.QUERY)
    @ApiOperation("谱文分类_列表")
    public Result<List<XyGenealogyCate>> list(XyGenealogyCateParam xyGenealogyCateParam) {
        List<XyGenealogyCate> list  =   xyGenealogyCateService.list(xyGenealogyCateParam);
        return success(list);
    }

    /**
     * 导出系统用户
     *
     * @author yanwei
     * @date 2023-05-05 15:44:29
     */
    @Permission
    @GetMapping("/xyGenealogyCate/export")
    @BusinessLog(title = "谱文分类_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
    @ApiOperation("谱文分类_导出")
    public void export(XyGenealogyCateParam xyGenealogyCateParam) {
        xyGenealogyCateService.export(xyGenealogyCateParam);
    }

}
